package com.ding.second.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.websocket.Session;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ding.second.socket.WebSocket;

@Controller
@RequestMapping("/chat")
public class ChatInfoAction {

	@RequestMapping("/info")
	@ResponseBody
	public List<String> getinfo(){
		Map<String, Session> userInfo = WebSocket.getSessionMap();
		Set<String> keySet = userInfo.keySet();
		List<String> userList = new ArrayList<String>();
		for (String userName : keySet) {
			userList.add(userName);
		}
		
		return userList;
	}
}
